﻿using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using Rhino.Mocks;
using TSVNAddinUtils;

namespace TSVNAddinUtils.Test
{
	[TestFixture]
	public class ResetAddinCommandFixture
	{
		[Test]
		public void Exec()
		{
			string installDir = @"c:\VS\";
			string fileName = installDir + "devenv.exe";
			string arguments = "/ResetAddin TSVNAddin.VS.Connect /command File.Exit";

			string[] args = new string[]{ fileName, arguments };

			ProcessExecutor pe = MockRepository.GenerateMock<ProcessExecutor>();
			pe.Expect(x => x.Exec(fileName, arguments));

			VisualStudioConfig vc = MockRepository.GenerateMock<VisualStudioConfig>((RegistryAdapter)null);
			vc.Expect(x => x.GetInstallDir()).Return(installDir);

			ResetAddinCommand command = new ResetAddinCommand(pe, vc);
			command.Exec(args);

			pe.VerifyAllExpectations();
			vc.VerifyAllExpectations();
		}
	}
}
